Skip to main content

Individual brand forecasts

When the forecast accuracy got from our method is compared to IBP forecasts, we get some brands for which we have significantly higher accuracy/lower errors. We would like to improve the accuracy even further for these brands.

Therefore, instead of forecasting for all brands in one go with one-hot-encoding them in a single dataframe, we filter out rows for individual brands and perform the forecasting solely on them.

These usually have a different set of features and model for optimal forecasts.

Doing this, we improve the forecast accuracy of these brands even further.

The original forecast values are then replaced with these new forecasts, which have been saved in a parquet file.

def replace_forecast(df, country brand):
brand_df = pd.read_parquet(f"data/{country}/{brand}.parquet")
df.loc[(df.brand == brand) & (df.date >= "2023-05-01") & (df.date <= "2024-04-01"), "forecast"] = brand_df.loc[(brand_df.index >= "2023-05-01") & (brand_df.index <= "2024-04-01"), "forecast"].values
return df


for brand in "brands":
df = replace_forecast(df, country, brand)